//
//  MyCouponModel.m
//  LoveBeeProject
//
//  Created by 沈腾飞 on 2017/1/5.
//  Copyright © 2017年 斯芬克斯. All rights reserved.
//

#import "MyCouponModel.h"
#import <YYModel.h>
#import "NetworkTool.h"
#import "MyCouponModel.h"
@implementation MyCouponModel


-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    //判断 如果 key 是description
    if([key isEqualToString:@"description"])
    {
        self.des = value;
    }
}

+ (void)loadNewsDataWithUrlStr:(NSString *)urlStr parameters:(id)parameters success:(void (^)(NSArray *))successBlock failed:(void (^)(NSError *))failedBlock{
    [[NetworkTool sharedTool] POSTWith:urlStr parameters:parameters success:^(id responseObject) {
        //接受responseObject
        
        id result = [NSJSONSerialization JSONObjectWithData:responseObject options:0 error:nil];
        NSArray *dataArr = result[@"data"];
        NSMutableArray *arrM = [NSMutableArray array];
        for (NSDictionary *dict in dataArr) {
            MyCouponModel *model = [[MyCouponModel alloc] init];
            [model setValuesForKeysWithDictionary:dict];
            [arrM addObject:model];
        }
        
        if (successBlock) {
            successBlock(arrM.copy);
        }
        
    } failed:^(NSError *error) {
        
    }];




}
@end
